#ifndef _QUANTUM_BUFFER_H__
#define _QUANTUM_BUFFER_H__

#include "../utils/gapbuffer/gapbuffer.h"
#include "cursor.h"
#include <fstream>

struct Buffer {
	GapBuffer gap_buffer;
	Cursor cursor;

	Buffer() : gap_buffer(), cursor({0}) {}

	Buffer(const std::string &filename) : Buffer() {
		std::basic_ifstream<type::char_type> f(filename);
		f.seekg(0, std::ios::end);
		auto length = f.tellg();
		f.seekg(0, std::ios::beg);
		type::char_type *buff = new type::char_type[length];
		f.read(buff, length);
		gap_buffer.InsertString(buff, length);
		f.close();
	}
};

#endif // _QUANTUM_BUFFER_H__
